home *** CD-ROM | disk | FTP | other *** search
- /* example Preview script file for TSMorph */
- /* This example renders all frames as 16 colour */
- /* grey scale images, with a resolution of ~128x64*/
- /* using the T: directory as a work directory */
- /* and then displays the animation using VT */
- /* */
- /* Frame number is taken as how often to render */
- /* frames, 1=every frame, 3=every third etc. */
- /* $VER: PreAnim_TSM 2.5 (6.2.94)
- */
-
- /* get arguments */
- parse arg Frame " " FileName
-
- /* Frame - current frame number */
- /* FileName - Filename of points file */
- /* */
- /* current Settings have previously been saved in */
- /* 'T:TSMorph.prefs' */
-
- /* make rexx the default command host */
- address "REXX"
- /* add rexxsupport.library if not already present */
- /* (required for next() */
- if ~(show('L','rexxsupport.library')) then
- call addlib('rexxsupport.library',0,-30,0)
- /* open input file */
- if open('infile',FileName,'r') then do
- /* open output file */
- if open('outfile','T:TSM.points','w') then do
- /* read possible header */
- line = readln('infile')
- /* write header */
- call writeln('outfile','TSMorph 1.2')
- if (line = 'TSMorph 1.2') then
- /* read over header */
- line = readln('infile')
- /* read and write input file names */
- call writeln('outfile',line)
- call writeln('outfile',readln('infile'))
- call writeln('outfile',readln('infile'))
- call writeln('outfile',readln('infile'))
- /* read output name */
- call readln('infile')
- /* write our output file name */
- call writeln('outfile','T:TSM.pic.%03ld')
- /* read and write details */
- line = readln('infile')
- parse var line "w=" width ",h=" height ",Frames=" frames ",Single=" single ",Start=" start
- call writeln('outfile',line)
- /* copy rest of file */
- do while ~(eof('infile'))
- call writeln('outfile',readln('infile'))
- end
- /* close output file */
- call close('outfile')
- /* calculate dx and dy parameters */
- /* image is then 128x64 minimum resolution */
- if (width > 128) then
- dx = trunc((width - 128) / 128)
- else
- dx = 0
- if (height > 64) then
- dy = trunc((height - 64) / 64)
- else
- dy = 0
- /* copy points for anim warps/morphs */
- if (single = 2) | (single = 3) then
- if (Frame < 10) then
- address command 'copy "'FileName'.00'Frame'" T:TSM.points.00'Frame
- else
- if (Frame < 100) then
- address command 'copy "'FileName'.0'Frame'" T:TSM.points.0'Frame
- else
- address command 'copy "'FileName'.'Frame'" T:TSM.points.'Frame
- /* Write Prescript */
- /* This only renders the requested frames */
- if open('pre','T:Prescript.TSM','w') then do
- /* Heading comment */
- call writeln('pre','/* Preview Prescript */')
- /* get arguments */
- call writeln('pre','parse arg Base')
- /* get frame number, from 1 */
- /* see Prescript.TSM for more info */
- call writeln('pre','f = C2D(IMPORT(D2C(STRIP(Base)),4),4)')
- /* get total frames */
- call writeln('pre','t = C2D(IMPORT(D2C(STRIP(Base)+4),4),4)')
- /* Assume frames are 1..n */
- /* if it is not one of our frames then */
- call writeln('pre','if (f~=0) & (f~=t+1) & (trunc(f/'Frame')*'Frame'~=f) then')
- /* do not produce this frame */
- /* see Prescript.TSM for more info */
- call writeln('pre',' call EXPORT(D2C(STRIP(Base)+40,4),RIGHT(D2C(0),4,D2C(0)),4)')
- /* Otherwise produce this frame */
- call writeln('pre','else')
- call writeln('pre',' call EXPORT(D2C(STRIP(Base)+40,4),RIGHT(D2C(1),4,D2C(0)),4)')
- /* stop */
- call writeln('pre','exit')
- /* close prescript file */
- call close('pre')
- /* call TSMorph-render to render frames */
- /* this saves BW16 Animation */
- /* Uses MODE=16 for speed */
- address command 'TSMorph:TSMorph-render INTEGER=YES FILES=T:TSM.points PRESCRIPT=T:Prescript POSTSCRIPT=Rexx/PostAnim CREATEICONSR=NO ANTIALIAS=NO DX='dx' DY='dy' SAVEFORMAT=BW16 MODE=16 SETTINGS=T:TSMorph.prefs'
- /* Display the output */
- address command "VT t:TSM_Anim"
- end
- end
- /* close input file */
- call close('infile')
- end
- /* the end! */
- exit
-